package web.jzs.action;

import java.util.ArrayList;

import Model.ShowBlogMessage;

import com.opensymphony.xwork2.ActionSupport;

import dao.ShowblogMessageDAO;

public class GetAllBlogAction extends ActionSupport {
	
	private ArrayList<ShowBlogMessage> allblogmessage;
	private ShowBlogMessage oneblog;
	
	public ShowBlogMessage getOneblog() {
		return oneblog;
	}

	public void setOneblog(ShowBlogMessage oneblog) {
		this.oneblog = oneblog;
	}

	public ArrayList<ShowBlogMessage> getAllblogmessage() {
		return allblogmessage;
	}

	public void setAllblogmessage(ArrayList<ShowBlogMessage> allblogmessage) {
		this.allblogmessage = allblogmessage;
	}

	public String getallblogmesssage()
	{
		ShowblogMessageDAO blogmessagedao=new ShowblogMessageDAO();
		allblogmessage=blogmessagedao.getAllShowMessage();
		if(allblogmessage!=null)
		{
			return SUCCESS;
		}
		return ERROR;
	}
	public String getablog()
	{
		ShowblogMessageDAO blogmessagedao=new ShowblogMessageDAO();
		
		oneblog=blogmessagedao.getAMessageByblogid(oneblog.getBlogid());
		if(oneblog!=null)
		{
			return SUCCESS;
		}
		return ERROR;
	}
}
